<?php
namespace services\models;

require_once ROOT_LIBRARY_APC .DS. 'fileCache.php';
require_once ROOT_LIBRARY_APC .DS. 'wrapperCache.php';


class oms {

    private $_db;
    private $_cache;


    public function __construct() {
        $config = include ROOT_CONFIG;
        
        $this->_db = \PDOWrapper::instance();
        $this->_db->configMaster($config['db']['master']);        
        $this->_cache = \wrapperCache::GetInstance($config['apc_cache']['cache_type'],
                                                    $config['apc_cache']['cache_expire'],
                                                    $config['apc_cache']['cache_path']);
    }

    public function get_stock($sku) {
        $sku = 15589;
        if(isset($sku)){
            if($this->_cache->cache('sku'. $sku)){
                return $this->_cache->cache('sku'. $sku);
            }else {
                $result = $this->_db->selectFirst('test', array('data'=> $sku));
                $this->_cache->cache('sku'. $sku, $result);
                return $result;
            }
        }
    }

}

?>
